Flow to Use OT Link Platform as an FTP Client

Estimated reading time: 4 minutes

The steps provided on this page illustrate how to access an FTP server, where OT Link Platform is the client.

This example lists the steps to configure a flow to get a file and then read the contents of the file:

Tips:

  • Use the filter nodes function in the node palette to find specific nodes, such as a file node.
  • As you modify flow configurations, be sure to save the flows. Otherwise, the nodes will exist only in the flow editor and the flows will not be executable.
  • Filenames used in node configurations are case sensitive.

Relevant references:

Create a Flow to Transfer a File to OT Link Platform

When files need to be transferred to the OT Link Platform device, do not use a USB drive because the file format and write permissions may cause issues. Instead, use FTP, a more secure and reliable method.

Use these steps to create an FTP Get flow to transfer a file to the OT Link Platform device:

In these steps, OT Link Platform is the ftp client. If you want to configure OT Link Platform to be an ftp server, see the instructions in FTP Server.

  1. On a system with an ftp server, create a file that contains some text. For this example, we are using HelloWorld.txt, which contains the text: Hello World! Let's connect.
  2. On the client, in OT Link Platform Flows, click Go to Flows.
  3. Drag the ftp node (under storage in the palette) onto the canvas.
    When you use the ftp node, OT Link Platform is always the client. Use an ftp node to interact with an ftp server for the standard ftp client actions: List, Get, Put, Delete.

  4. Double-click the ftp node to launch the editor where you will configure the FTP server.
  5. In the edit dialog, click the pencil  to add a new FTP server.
  6. Enter the configuration parameters and click Add.
    Enter the FTP server details to establish a connection with OT Link Platform.

    • Host: IP address of the FTP server.
    • Username: The FTP username.

    • Password: The password for the FTP user. 
    • Port: If it is a OT Link Platform FTP server, use port 2121.
  7. Back in the Edit ftp in node dialog, configure the following and then click Done.

    1. Operation: get
    2. Filename: The name of the source file on the remote machine that you are transferring/getting. For this example, enter: /HelloWorld.txt
    3. Local Filename: The destination filename on the OT Link Platform client. For this example, enter: /Hello.txt
      Note: Be sure to include the forward slash ( / ) in the filename.

    4. Name: (optional) Enter a name for the FTP node in the flow.

  8. Drag a debug node onto the canvas, to the right of the ftp in node, and connect it to the ftp in node.
  9. Drag an inject node onto the canvas, to the left of the ftp in node, and connect it to the ftp in node.
  10. Click Save to save the flow you just created.
  11. Go to Trigger the Flows to trigger the FTP Get operation. The status can be viewed in the debug tab, beneath the canvas.

Create a Flow to Read File Contents

In this scenario, the file in node is used to read the contents of the file that was just transferred to the device with the FTP flow.

  1. Drag the file innode (under storage in the palette) onto the canvas and modify its parameters.
    1. Enter the filename. For the purpose of this example, enter the file that was just transferred to the OT Link Platform client: /Hello.txt
    2. Output as a utf8 string.
  2. Drag an inject node onto the canvas, to the left of the file in node, and connect it to the file in node. This serves as the input node in the flow.
  3. Drag a debug node onto the canvas, to the right of the file in node, and connect it to the file in node. This serves as the output node.
  4. Click Save to save the flow you just created.
  5. Go to Trigger the Flows to trigger the _File Read _operation. The status can be viewed in the debug tab, beneath the canvas.

Trigger the Flows

The flows you created in the previous procedures should look something like this:

To inject/activate the flows:

  1. First, click the button on the inject (timestamp) node of the ftp flow.
    The timestamp simply serves as a trigger for an event. In this case, it is doing the ftp get.
  2. Then, click the button on the inject (timestamp) node of the file in flow, which reads the contents of the file.
  3. Beneath the canvas, select the debug tab to view the results of the triggered flows.

Troubleshoot Flows

If you do not see the expected results, check the following:

  • Have you saved recent flow changes? Click Save above the canvas at the right.
  • Is the Debug node activated? Toggle the switch on the Debug node.